Skip to content

Conversation

@zasdfgbnm
Copy link
Collaborator

No description provided.

@zasdfgbnm
Copy link
Collaborator Author

!test

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Review updated until commit c95a584

Description

  • Add new utility function resetContiguityFromTensor to ir_utils namespace

  • Function infers and resets TensorView contiguity based on actual at::Tensor sizes/strides

  • Handles complex dimension types: iteration, broadcast, and reduction dimensions

  • Includes comprehensive test suite covering all contiguity combinations

Changes walkthrough

Relevant files
Enhancement
utils.cpp
Implement resetContiguityFromTensor utility function         

csrc/ir/utils.cpp

  • Added new function resetContiguityFromTensor implementation
  • Function computes contiguity by iterating allocation domain
    right-to-left
  • Handles reduction dimensions (skip), broadcast dimensions (nullopt),
    iteration dimensions (compute contiguity)
  • Uses stride relationships to determine contiguity: stride equals
    next_stride * next_size
  • Added #include for tensor metadata functionality
  • +63/-0   
    Tests
    test_utils.cpp
    Add comprehensive tests for resetContiguityFromTensor       

    tests/cpp/test_utils.cpp

  • Added comprehensive test ResetContiguityFromTensor with 8 test cases
  • Tests create TensorView with mixed dimension types: iteration,
    broadcast, reduction
  • Tests all 2^3 = 8 contiguity combinations for 3 iteration dimensions
  • Verifies correct contiguity computation based on stride relationships
  • Tests edge cases including broadcast dimensions not at position 0
  • +109/-0 
    Documentation
    utils.h
    Add function declaration and documentation                             

    csrc/ir/utils.h

  • Added function declaration for resetContiguityFromTensor
  • Included detailed documentation explaining function purpose and
    behavior
  • Documents handling of broadcast and reduction dimensions
  • +6/-0     

    PR Reviewer Guide

    Here are some key observations to aid the review process:

    🧪 PR contains tests
    ⚡ No major issues detected

    @zasdfgbnm
    Copy link
    Collaborator Author

    !test

    @zasdfgbnm
    Copy link
    Collaborator Author

    !test

    1 similar comment
    @zasdfgbnm
    Copy link
    Collaborator Author

    !test

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants